import request from '@/utils/request'


// 参加训练
export function joinTrain(data) {
  return request({
    url: '/manager/train/join',
    method: 'post',
    data: data
  })
}
// 查询训练列表
export function listTrain(query) {
  return request({
    url: '/manager/train/list',
    method: 'get',
    params: query
  })
}

export function trainToUser(data) {
  return request({
    url: '/manager/train/trainToUser',
    method: 'post',
    data: data
  })
}

// 查询训练详细
export function getTrain(trainId) {
  return request({
    url: '/manager/train/' + trainId,
    method: 'get'
  })
}

// 新增训练
export function addTrain(data) {
  return request({
    url: '/manager/train',
    method: 'post',
    data: data
  })
}

// 修改训练
export function updateTrain(data) {
  return request({
    url: '/manager/train',
    method: 'put',
    data: data
  })
}

// 删除训练
export function delTrain(trainId) {
  return request({
    url: '/manager/train/' + trainId,
    method: 'delete'
  })
}

// 提交请假申请
export function leaveTrain(data) {
  return request({
    url: '/manager/train/leave',
    method: 'post',
    data: data
  })
}

// 获取请假状态
export function getLeaveStatus(trainId) {
  return request({
    url: '/manager/train/leave/' + trainId,
    method: 'get'
  })
}
